/**
 * Created by user on 2018/4/12.
 */
import React, {Component} from 'react'
import {connect} from 'react-redux'
import './less/app.less'
import Loading from './components/Loading'
import {GlobalActions} from './actions'
import CustomMenu from './components/menu/CustomMenu';
import CustomHeader from './components/header/CustomHeader';
import { bindActionCreators } from 'redux';
import { Layout, Menu, Icon } from 'antd'
const { Content, Footer } = Layout



class App extends Component {
  clickSingle = () => {
    const {toggleLoading} = GlobalActions
    const {dispatch, loading} = this.props
    dispatch(toggleLoading(!loading))
  }

  render() {
    return (
      <Layout>
        <CustomMenu path={ this.props.location.pathname }/>
        <Layout style={{flexDirection: 'column'}}>
          <CustomHeader />
          <Content style={{ margin: '24px 24px 0', height: '100%' }}>
            {this.props.children}
          </Content>
          <Footer style={{ textAlign: 'center' }}>
            React-Admin ©2017 Created by 865470087@qq.com
          </Footer>
        </Layout>
      </Layout>
    )
  }
}

const mapStateToProps = (state) => {
  return {
    loading: state.GlobalState.loading
  }
}
export default connect(mapStateToProps)(App)
